home *** CD-ROM | disk | FTP | other *** search
- /***************************************************** IMPLEMENTATION
- DATE: 10/28/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPVisualTreeNode
-
- SUPERCLASS: CPPTreeNode
-
- This C++ class manages the visual representation of a node
- in a hierarchical tree
-
- ********************************************************************/
-
- #pragma once
-
- #include <CPPTreeNode.h>
-
- class CPPVisualTree;
-
- #define kSetSelect 1
- #define kClearSelect 0
- #define kToggleSelect -1
-
- #define kEraseFamily 15
- #define kDrawFamily 16
- #define kResizeFamily 17
- #define kMoveFamily 18
-
- typedef enum
- {
- kNoJoin = 0, /* don't draw lines b/w nodes */
- kPointToPoint, /* draw a line directly b/w nodes */
- kRightAngle /* draw an aesthetically squared line b/w nodes */
- } joinTypes;
-
- typedef enum
- {
- kTopDown = 0, /* draw the tree from top to bottom */
- kBottomUp = 1, /* draw from bottom to top */
- kRight2Left = 2, /* draw from right to left */
- kLeft2Right = 3 /* draw from left to right */
- } orientStyle;
-
- typedef enum
- {
- kJustCenter = 0, /* center the parent wrt the children */
- /* positioning constants for left2right/right2left displayStyle */
- kJustLeft, /* put the parent to the left of its children */
- kJustRight, /* put the parent to the right of its children */
- /* positioning constants for topdown/bottomup displayStyle*/
- kJustTop=kJustRight, /* put the parent above its children */
- kJustBottom=kJustLeft /* put the parent below its children */
- } justStyle;
-
-
-
- class CPPVisualTreeNode : public CPPTreeNode {
- friend class CPPVisualTree;
- public:
- Boolean needsResize;
- Boolean needsMove;
- Boolean needsDraw;
- Boolean notYetPlaced;
-
- CPPVisualTreeNode (CPPObject *NodeData, CPPTree *BelongsTo,
- Boolean becomeOwner, Boolean selected);
- ~CPPVisualTreeNode (void);
-
- virtual char *ClassName (void);
- virtual Boolean Member (char *className);
-
- virtual CPPObject *Clone(void);
-
- virtual void DrawJoin (CPPVisualTreeNode *FromNode,
- CPPVisualTreeNode *ToNode);
- virtual void EraseJoin (CPPVisualTreeNode *FromNode,
- CPPVisualTreeNode *ToNode);
- virtual void DrawNodeData (void);
-
- void DrawNode (Boolean wholeFamily, Boolean forceDraw);
- virtual void EraseNode (Boolean wholeFamily);
- void ResizeFamily (Boolean wholeFamily);
- void MoveFamily (Point *topLeft);
-
- virtual void CalcNodeSize (void);
- void CalcFamilySize(void);
- void CalcFamilyBounds(Point TopLeftCorner);
-
- static long NumSelectedNodes (CPPVisualTreeNode *theNode);
-
- Boolean CanDraw (void);
-
- inline Boolean IsSelected (void) {return this->isSelected;}
- void SetSelect (short selectType, Boolean selectFamily,
- Boolean doRedraw);
-
- void GetAnchorPoints (Point *Left, Point *Right,
- Point *Top, Point *Bottom);
-
- virtual void ReceiveMessage (CPPGossipMonger *toldBy,
- short reason, void* info);
- virtual void GetFamilyBounds (Rect *bounds);
-
- CPPVisualTreeNode *PointInNode (Point clickPt);
-
- void DoOnFamilyInRect (Rect *theRect, Boolean fullyInside,
- ApplyProc theProc, long param);
-
- virtual void DoDoubleClick (short modifiers);
- virtual void DoSingleClick (short modifiers);
-
- protected:
- Point nodeSize,
- childSize,
- familySize;
- Rect nodeRect, // the rectangle surrounding the node
- childRect, // surrounds the node's immediate children
- gChildRect, // surrounds all of the node's descendants
- familyRect; // surrounds the node & all its descendants
-
- virtual void DoCalcFamilySize(void);
- virtual void DoCalcFamilyBounds (Point TopLeftCorner);
-
- short GetNodeMargin (void);
- orientStyle GetOrientation (void);
- justStyle GetJustification (void);
- joinTypes GetJoinType (void);
- short GetBranchLength (void);
-
- Boolean isSelected;
-
- };
-
-